{extend name="Base/base"/}

{block name="body"}
<!-- 标题 -->
    <div class="main-title">
        <h2>
            价格设置                   </h2>
    </div>

    <div style="margin-bottom: 10px;" class="hide" id="search_form">

        <style>
            .tb_search td{
                padding: 5px 10px;
            }
        </style>

        <div style="border-top:1px solid #ccc;border-bottom: 1px solid white"></div>
    </div>
    <!-- 按钮工具栏 -->
    <div class="with-padding">
        <div class="fl">

            <a href="{:url('',array('action'=>'add'))}" class="btn btn-ajax btn-success btn">新增价格选项</a>&nbsp;
            <button class="btn ajax-post btn" url="{:url('',array('action'=>'delete'))}" target-form="ids">删除</button>&nbsp;

            <!-- 选择框select -->
            <div style="float: right;">
                <style>
                    .oneselect{
                        display: inline-block;
                        margin-left: 10px;
                    }
                    .oneselect .title{
                        float: left;
                        line-height: 32px;
                    }
                    .oneselect .select_box{
                        float: left;
                        line-height: 32px;
                    }
                    .oneselect .select_box select{
                        min-width: 200px;
                    }
                </style>
            </div>
        </div>

    </div>


    <!-- 数据表格 -->
    <div class="with-padding" stype="width:auto; overflow: auto;">
        <form class="ids">
        <table id="table-data" class="table table-bordered table-striped table-hover">
            <!-- 表头 -->
            <thead>
            <tr>
                <th class="row-selected row-selected" style="width: 20px">
                    <input class="check-all" type="checkbox">
                </th>
                <th>价格标识</th><th>适用范围</th><th>价格说明</th><th>价钱</th><th>状态</th><th>操作</th>            </tr>
            </thead>
            <!-- 列表 -->
            <tbody>
            {foreach name="list" item="vo"}
            <tr>
                <td>
                    <input class="ids row-selected" type="checkbox" name="ids" value="{$vo.id}">
                </td>
                <td>{$vo.title}</td>
                <td>{$vo.cat_title}</td>
                <td>{$vo.content}</td>
                <td>{$vo.price}</td>
                <td>{if condition="$vo['status'] == 0"}启用{else/}禁用{/if}</td>
                <td>
                    <a href="{:url('',array('action'=>'add','id'=>$vo['id']))}">编辑</a>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        </form>
    </div>
    <!-- 分页 -->
    <div class="with-padding">
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
    $(function () {
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮


    });
</script>
{/block}